package com.redepronik.negosys.seguridad.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * The persistent class for the menu database table.
 * 
 */
@Entity
@Table(schema = "seguridad", name = "menu")
@NamedQuery(name = "Menu.findAll", query = "SELECT m FROM Menu m")
public class Menu implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(allocationSize = 1, name = "MENU_MENUID_GENERATOR", sequenceName = "SEGURIDAD.MENU_MENUID_SEQ")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MENU_MENUID_GENERATOR")
	@Column(unique = true, nullable = false)
	private Integer menuid;

	@Column(length = 500)
	private String clase;

	@Column(length = 500)
	private String estilo;

	@Column(length = 50)
	private String icono;

	private Integer nivel;

	@Column(nullable = false, length = 50)
	private String nombre;

	@Column(nullable = false)
	private Boolean visible;

	@Column(nullable = false)
	private Integer orden;

	private Integer padre;

	@Column(length = 200)
	private String vista;

	// bi-directional many-to-one association to Rolmenu
	@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = "menu")
	private List<Rolmenu> rolmenus;

	public Menu() {
	}

	public Rolmenu addRolmenus(Rolmenu rolmenus) {
		getRolmenus().add(rolmenus);
		rolmenus.setMenu(this);

		return rolmenus;
	}

	public String getClase() {
		return this.clase;
	}

	public String getEstilo() {
		return this.estilo;
	}

	public String getIcono() {
		return this.icono;
	}

	public Integer getMenuid() {
		return this.menuid;
	}

	public Integer getNivel() {
		return this.nivel;
	}

	public String getNombre() {
		return this.nombre;
	}

	public Integer getOrden() {
		return this.orden;
	}

	public Integer getPadre() {
		return this.padre;
	}

	public List<Rolmenu> getRolmenus() {
		return this.rolmenus;
	}

	public Boolean getVisible() {
		return visible;
	}

	public String getVista() {
		return this.vista;
	}

	public Rolmenu removeRolmenus(Rolmenu rolmenus) {
		getRolmenus().remove(rolmenus);
		rolmenus.setMenu(null);

		return rolmenus;
	}

	public void setClase(String clase) {
		this.clase = clase;
	}

	public void setEstilo(String estilo) {
		this.estilo = estilo;
	}

	public void setIcono(String icono) {
		this.icono = icono;
	}

	public void setMenuid(Integer menuid) {
		this.menuid = menuid;
	}

	public void setNivel(Integer nivel) {
		this.nivel = nivel;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	public void setOrden(Integer orden) {
		this.orden = orden;
	}

	public void setPadre(Integer padre) {
		this.padre = padre;
	}

	public void setRolmenus(List<Rolmenu> rolmenus) {
		this.rolmenus = rolmenus;
	}

	public void setVisible(Boolean visible) {
		this.visible = visible;
	}

	public void setVista(String vista) {
		this.vista = vista;
	}

}